﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using aUser = Portal.Core.Data.Customer.aUsers;

namespace Portal.Core.Customer
{
    public class bUser
    {
        public static string UserName;
        public static string PassWord;
        public static float Gold;
        public static string FullName;
        public static string Email;
        public static DateTime BirthDay;
        public static string PhoneNumber;
        public static string Avatar;
        public static int is_admin;
        public static int is_blocked;
        public static void GetDetailCustomerForID(int ID)
        {
            DataTable tb = aUser.GetInformationCustomer(ID).Tables[0];
            if (tb.Rows.Count > 0)
            {
                UserName = tb.Rows[0]["Username"].ToString();
                PassWord = tb.Rows[0]["Password"].ToString();
                Gold = float.Parse(tb.Rows[0]["Gold"].ToString());
                FullName = tb.Rows[0]["Fullname"].ToString();
                Email = tb.Rows[0]["Email"].ToString();
                BirthDay = DateTime.Parse(tb.Rows[0]["Birthday"].ToString());
                PhoneNumber = tb.Rows[0]["Phonenumber"].ToString();
                Avatar = tb.Rows[0]["Avatar"].ToString();
                is_admin = int.Parse(tb.Rows[0]["is_admin"].ToString());
                is_blocked = int.Parse(tb.Rows[0]["is_blocked"].ToString());
            }
        }
        public static int UpdateInfoCustomer(int Id, string Fullname, DateTime BirthDay, string PhoneNumber, string Avatar)
        {
            return aUser.UpdateInfoCustomer(Id, Fullname, BirthDay, PhoneNumber, Avatar);
        }

        public static int RegisterCustomer(string UserName, string PassWord, string FullName, string Email, DateTime BirthDay, string PhoneNumber, string Avatar,string Confirm_Code)
        {
            return aUser.RegisterCustomer(UserName, PassWord, FullName, Email, BirthDay, PhoneNumber, Avatar, Confirm_Code);
        }
        public static int ConfirmRegisterCustomer(string Email, string ConfirmCode)
        {
            return aUser.ConfirmRegisterCustomer(Email, ConfirmCode);
        }
        public static int DeleteRegisterCustomer(int Id)
        {
            return aUser.DeleteRegisterCustomer(Id);
        }
        public static int ResetPassword(string email,string repass)
        {
            return aUser.ResetPassword(email, repass);
        }
        public static int CheckLoginUserWeb(string email, string password)
        {
            return aUser.CheckLoginUserWeb(email, password);
        }
        public static int ChangedPassword(string username, string mkcu, string mkmoi)
        {
            return aUser.ChangedPassword(username, mkcu, mkmoi);
        }
    }
}
